package main;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.GameCanvas;

import control.ControlCommand;
import control.DrawButton;
import control.Panel;
import control.TextControl;

public class AboutCanvas extends GameCanvas {
	protected Panel panel;
	protected final MainMidlet game;
	//protected Image background;

	protected AboutCanvas(MainMidlet midlet) {
		super(true);
		this.game = midlet;
		setFullScreenMode(true);
		panel = new Panel(20, 20, 200, 360, 2);
		panel.setControl(0, new TextControl("The Guardians Version 1.0.0\n\n" +
				"The game was created and \n" +
				"published by FCloud", 30, 50));
		panel.setControl(1,  new DrawButton(-1, 160, 340, 60, 40, "BACK"));
		panel.get(1).setCommand(new ControlCommand() {
			public void Do() {
				game.showMenuCanvas();
			}
		});
	}

	protected void pointerPressed(int x, int y) {
		panel.pointerPressed(x, y);
		repaint();
	}

	protected void pointerReleased(int x, int y) {
		panel.pointerReleased(x, y);
		repaint();
	}

	protected void pointerDragged(int x, int y) {
		panel.pointerPressed(x, y);
		repaint();
	}

	public void paint(Graphics g) {
	//	g.drawImage(background, 0, 0, 0);
		g.setColor(0x886600);
		g.fillRect(0, 0, 240, 400);
		panel.paint(g);
	}
}